﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using SevenInvaders.common;


namespace SevenInvaders
{
    class AdilioPlayer : Player
    {
        animation animation1;

        public AdilioPlayer(Texture2D texture, Vector2 position, int player, GameWindow gameWindow, ContentManager Content)
            : base(texture, position, player, gameWindow, Content)
        {
            animation1 = new animation();
            animation1.frame.X = 0;
            animation1.frame.Y = 0;
            animation1.frame.Width = 58;
            animation1.frame.Height = 50;

            animation1.frames = 4;
            animation1.fps = 7;

            current_animation = animation1;

        }

        public void Update(GameTime gameTime, KeyboardState ks)
        {
            #region Movimentação
            if (ks.IsKeyDown(Keys.Right))
            {
                this.PositionX += 5;
            }

            if (ks.IsKeyDown(Keys.Left))
            {
                this.PositionX -= 5;
            }

            if (ks.IsKeyDown(Keys.Up))
            {
                this.PositionY -= 5;
            }

            if (ks.IsKeyDown(Keys.Down))
            {
                this.PositionY += 5;
            }
            #endregion

            #region Tiro
            if (ks.IsKeyDown(Keys.Space) && !ks.IsKeyDown(Keys.Space))
            {
                //Shoot.list.Add(new Shoot(Game1.jonathantiro, this.Position, Shoot.Direction.UP, this.Velocity));
            }
            #endregion

            #region Colisao borda da tela
            if (this.PositionX + this.Texture.Bounds.Width > Window.ClientBounds.Width)
            {
                this.PositionX = Window.ClientBounds.Width - this.Texture.Bounds.Width;
            }

            if (this.PositionX <= 0)
            {
                this.PositionX = 0;
            }

            if (this.PositionY + this.Texture.Bounds.Height > Window.ClientBounds.Height)
            {
                this.PositionY = Window.ClientBounds.Height - this.Texture.Bounds.Height;
            }

            if (this.PositionY <= 0)
            {
                this.PositionY = 0;
            }
            #endregion

        }
    }
}